//
//  SASearchStoreUserCell.m
//  saasRetail
//
//  Created by 黄志刚 on 2021/4/21.
//

#import "SASearchStoreUserCell.h"
#import "SAVipModel.h"
#import "SAStoreUserModel.h"
#import "SASupplierModel.h"
#import "SAStoreModel.h"

@interface SASearchStoreUserCell ()

@property (nonatomic, strong) UILabel *titleLab;

@end

@implementation SASearchStoreUserCell

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    if(self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]){
        self.selectionStyle = UITableViewCellSelectionStyleNone;
        self.backgroundColor = [UIColor whiteColor];
        [self initUI];
    }
    return self;
}

-(void)setModel:(SAVipModel *)model {
    _model = model;
    
    if (model.mobile.length > 0) {
        self.titleLab.text = [NSString stringWithFormat:@"%@(%@)",model.memberName,model.mobile];
    }else {
        self.titleLab.text = model.memberName;
    }
}

-(void)setUserModel:(SAStoreUserModel *)userModel {
    _userModel = userModel;
    if (userModel.mobile.length > 0) {
        self.titleLab.text = [NSString stringWithFormat:@"%@(%@)",userModel.empName,userModel.mobile];
    }else {
        self.titleLab.text = userModel.empName;
    }
    if (userModel.select == YES) {
        self.titleLab.textColor = kPinkColor;
    }else {
        self.titleLab.textColor = kBlackColor;
    }
}

-(void)setSupplierModel:(SASupplierModel *)supplierModel {
    _supplierModel = supplierModel;
    if (supplierModel.mobile.length > 0) {
        self.titleLab.text = [NSString stringWithFormat:@"%@(%@)",supplierModel.providerName,supplierModel.mobile];
    }else {
        self.titleLab.text = supplierModel.providerName;
    }
}

-(void)setStoreModel:(SAStoreModel *)storeModel {
    _storeModel = storeModel;
    self.titleLab.text = storeModel.storeName;
}

-(void)initUI {
    UILabel *titleLab = [[UILabel alloc] initWithFrame:CGRectMake(kScaleNum(18), 0, kScaleNum(200), kScaleNum(35))];
    titleLab.font = kFont(14);
    titleLab.textColor = kBlackColor;
    [self.contentView addSubview:titleLab];
    self.titleLab = titleLab;
    
    UIView *line = [[UIView alloc] initWithFrame:CGRectMake(0, kScaleNum(35), kScreenWidth - kScaleNum(49), kScaleNum(1))];
    line.backgroundColor = kLineColor;
    [self.contentView addSubview:line];
}

@end
